import React, {PropsWithChildren} from 'react'
import Taro from "@tarojs/taro";
import {Cell} from "@nutui/nutui-react-taro";

export interface CopyableCellProps extends PropsWithChildren {
    title:string
    value:string
}

const CopyableCell: React.FC<CopyableCellProps> = ({title,value}) => {
    return <>
        <Cell title={title} extra={value} onClick={() => {
            Taro.setClipboardData({
                data: value
            }).then(()=>{
                Taro.showToast({
                    title: `${title}已复制`,
                    duration: 1000,
                })
            });
        }}/>
    </>
}

export default CopyableCell


